//分类列表
exports.index = function(req , res){
	var async = require('async'),
	classId = req.body.classId ? req.body.classId*1:1,
	SubclassId = req.body.SubclassId ? req.body.SubclassId*1:1,
	mysql = require('mysql'),
	list = req.body.list ? " limit " + (req.body.list*1-1)*5 + " , 5" : " limit 0,5 ",
	cid = req.body.classId ? req.body.classId*1 : 1,
	sidSql = req.body.SubclassId ? " and a.sid = "+req.body.SubclassId*1+"  " :" ",
	sidGroup = req.body.SubclassId ? "" : " GROUP BY  a.`sid` ";
	client = mysql.createConnection(myDb);
	client.connect();
	client.query("use " + myDb.DbName);
	console.log('SELECT a.imgPath,a.title,a.id as vid,a.cid as classId,b.id as SubclassId,b.className as SubclassName FROM  `360_class_view` as a join `360_class_relation` as b WHERE  b.id = a.sid '+sidSql+' and a.`cid`='+cid+sidGroup+' ORDER BY  a.`addtime` DESC'+list);
	client.query('SELECT a.imgPath,a.title,a.id as vid,a.cid as classId,b.id as SubclassId,b.className as SubclassName FROM  `360_class_view` as a join `360_class_relation` as b WHERE  b.id = a.sid '+sidSql+' and a.`cid`='+cid+sidGroup+' ORDER BY  a.`addtime` DESC'+list,
		function selectCb(err, returnData){
			if(returnData.length)
				res.send(JSON.stringify({code:'1',data:returnData}));
			else
				res.send(JSON.stringify({code:'1',data:[]}));
		}
	)
}



//分类信息评价
exports.comment = function(req , res){
	
	
	
}



//分类信息点赞和踩
exports.opinion = function(req , res){
	
	
	
}